//
//  ExtraButton.m
//  哎游
//
//  Created by 刘建镇 on 15-1-13.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Masonry.h"
#import "ExtraButton.h"

@implementation ExtraButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (void)dealloc
{
    [_extraLabel release];
    [_imageV release];
    [super dealloc];
}

+ (id)buttonWithType:(UIButtonType)buttonType
{
    ExtraButton *button = [super buttonWithType:buttonType];
    
    
    return [button autorelease];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        self.view.userInteractionEnabled = NO;
        [self addSubview:_view];
        [_view release];

        
        self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 10, 100, 100)];
        [self.view addSubview:_imageV];
//        _imageV.userInteractionEnabled = NO;
        [_imageV release];
        [_imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.mas_centerX).offset(0);
            make.centerY.mas_equalTo(self.mas_centerY).offset(-12);
        }];
        
        self.extraLabel = [[UILabel alloc] init];
        self.extraLabel.backgroundColor = [UIColor clearColor];
        self.extraLabel.adjustsFontSizeToFitWidth = YES;
        self.extraLabel.textAlignment = NSTextAlignmentLeft;
        self.extraLabel.numberOfLines = 0;
//        self.extraLabel.userInteractionEnabled = NO;

        self.extraLabel.font = [UIFont fontWithName:@"Helvetica" size:15.f];
        [self.view addSubview:self.extraLabel];
        [_extraLabel release];

        [self.extraLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self.mas_centerX).offset(0);
            make.centerY.mas_equalTo(self.mas_centerY).offset(20);
        }];
    }
    return self;
}
@end
